#include "dev.h"


/**
 * @description: 定时器初始化  10us period用作LED状态机
 * @return {*}
 */
 
 
void Timer_init(void)
{
    BTIM_TimeBaseInitTypeDef BTIM_TimeBaseInitStruct = {0};

    BTIM_TimeBaseInitStruct.BTIM_Mode = BTIM_MODE_TIMER;
    BTIM_TimeBaseInitStruct.BTIM_Period = (480 - 1);
    BTIM_TimeBaseInitStruct.BTIM_Prescaler = (1 - 1);    //48MHz / 480 / 1 = 100KHz period = 10us
    BTIM_TimeBaseInitStruct.BTIM_CountMode = BTIM_COUNT_MODE_REPETITIVE;  //重复计数

    BTIM_TimeBaseInit(CW_BTIM1, &BTIM_TimeBaseInitStruct);
    BTIM_ITConfig(CW_BTIM1, BTIM_IT_UPDATE, ENABLE);
    BTIM_Cmd(CW_BTIM1, ENABLE);

    NVIC_EnableIRQ(BTIM1_IRQn);
}


